﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace HYSoft.Web
{
    public partial class deleteuser : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["Type"] != null && Request.QueryString["ID"] != null)
            {
                string Type = Request.QueryString["Type"];  //取得操作类型

                string ID = Request.QueryString["ID"];
                //  int ID = Int32.Parse(Input.checkID(Request.QueryString["ID"]));  //取得需要操作的管理员ID
                switch (Type)
                {
                    case "Del":

                        Del(ID);
                        break;
                }
            }
            data_list();
        }

        protected void data_list()
        {
            //DataTable dt = da.chektable("*,case type when 0 then '普通用户' when 1 then '单位用户' else '超级管理员' end as 'UserType' ", "[user]", "");
            // DataTable dt = HYSoft.DBUtility.DbHelperSQL.Query("select *,case type when 0 then '普通用户' when 1 then '单位用户' else '超级管理员' end as 'UserType' from [user]").Tables[0];
            string sql = "select *,case type when 0 then '普通用户' when 1 then '单位用户' else '超级管理员' end as 'UserType' from [user]";
            DataTable dt = new BLL.user().GetList(sql, 0).Tables[0];
            if (dt.Rows.Count > 0)
            {
                //Repeater1.DataSource = dt;
                //Repeater1.DataBind();
                ListView1.DataSource = dt;
                ListView1.DataBind();
            }
            dt.Clear();
            dt.Dispose();
        }

        protected void Del(string ID)
        {
           // comm_data da = new comm_data();
            int gid = Int32.Parse(ID.Trim());
            new BLL.user().Delete(gid);
            Response.Write("<script>alert('删除监测点成功！');window.location = 'deleteuser.aspx';</script>");
        }
    }
}